Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover interactively when the folder is not specified or is wrong #147

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

illright
Copy link
Member

@illright illright commented Dec 15, 2024

Closes #40. I wanted to start adding some delight ✨ to the CLI, this is the first step.

If the person doesn't specify any folder, we will now check if there's a src or app in the current folder and suggest those. We will also suggest to run in the current folder. If it matches what the person wanted to do, then we will print what command they should run next time if they want to repeat it. If it doesn't, we will casually mention the correct usage and leave the person alone (without an error exit code).

If the person specifies a folder, but it doesn't exist or is a file (for example, when they don't use terminal autocomplete and make a typo), then we will assume that most of what they wrote is correct and will try to correct typos. For example, if they wrote pachages/stieger/scr, we can trace this path and realize that they probably meant packages/steiger/src and then suggest to run the command there.

Screenshots

If no folder was specified and there are no obvious candidates in the current folder:

image

If that's not what the person wants:

image

When there's a src in the current folder:

image

When they made a typo and there's an obvious candidate:

image

When they accept the suggestion, we're informing them of what command is actually being run now (so that they can copy it, for example):

image

Typos can occur in different path segments:

image

When there's a dist folder, we don't consider it as a candidate because it's very unlikely that someone wants to check dist:

image

When there are several possible candidates that the person could mean:

image

Copy link

changeset-bot bot commented Dec 15, 2024

🦋 Changeset detected

Latest commit: 45dcacd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
steiger Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@illright illright requested a review from daniilsapa December 15, 2024 22:31
@daniilsapa
Copy link
Collaborator

I've not finished reviewing yet but left some first comments

@daniilsapa
Copy link
Collaborator

Also, question, should this be included in the next minor release? If so, then we need to change the destination branch to next

@illright
Copy link
Member Author

illright commented Dec 19, 2024

I don't think this is particularly ground-breaking, so I wouldn't mind including it in 0.5.4 as well. Although we will have to change the changeset

daniilsapa
daniilsapa previously approved these changes Dec 27, 2024
Copy link
Collaborator

@daniilsapa daniilsapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Now it looks good to go

Copy link

pkg-pr-new bot commented Dec 27, 2024

Open in Stackblitz

npm i https://pkg.pr.new/feature-sliced/steiger/@feature-sliced/steiger-plugin@147
npm i https://pkg.pr.new/feature-sliced/steiger/@steiger/toolkit@147
npm i https://pkg.pr.new/feature-sliced/steiger@147

commit: 45dcacd

@daniilsapa
Copy link
Collaborator

Yes, you're right 👍, I missed that point during the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-detect the source code root if no paths are passed
2 participants